package com.atguigu.qqzone.service.impl;

import com.atguigu.qqzone.dao.HostReplyDAO;
import com.atguigu.qqzone.pojo.HostReply;
import com.atguigu.qqzone.service.HostReplyService;

import java.util.List;

/**
 * @ClassName: HostReplyServiceImpl
 * @Description:
 * @Author: wty
 * @Date: 2022/12/9
 */

public class HostReplyServiceImpl implements HostReplyService {
    private HostReplyDAO hostReplyDAO;

    @Override
    public HostReply getHostReplyByReplyId(Integer replyId) {
        String sqlStr = "SELECT * FROM qqzonedb2.`t_host_reply` a WHERE a.`reply` = ?";
        return hostReplyDAO.querySingleHostReply(sqlStr, replyId);
    }

    @Override
    public void addHostReply(HostReply hostReply) {
        String sqlStr = "INSERT INTO qqzonedb2.`t_host_reply` VALUES (0,?,?,?,?)";
        hostReplyDAO.dml(sqlStr, hostReply.getContent(), hostReply.getHostReplyDate(), hostReply.getAuthor().getId(), hostReply.getReply().getId());
    }

    @Override
    public void delHostReply(Integer id) {
        String sqlStr = "DELETE FROM qqzonedb2.`t_host_reply` WHERE id = ?";
        hostReplyDAO.dml(sqlStr, id);
    }


}
